home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Online / tablePlug / rx / ae_border.tpx < prev    next >
Text File  |  1999-10-11  |  1KB  |  69 lines

  1. /*
  2.  
  3.     ae_border.tpx v2.0 © 1999 Esteve Boix
  4.  
  5.     Uses ArtEffect to load and scale the image, and
  6.     paints a border of any color around it.
  7.  
  8.     Tested with ArtEffect3, should work on v2 (and v1 ???).
  9.  
  10.     Args: SIZEX SIZEY BORDER_CLR_R BORDER_CLR_G BORDER_CLR_B BORDER_WIDTH JPEG_COMPRESSION
  11.  
  12.     Where:
  13.  
  14.         SIZEX, SIZEY        Size in pixels of the thumbnail
  15.         BORDER_CLR_R        Border R color
  16.         BORDER_CLR_G        Border G color
  17.         BORDER_CLR_B        Border B color
  18.         BORDER_WIDTH        Size of the border
  19.         JPEG_COMPRESSION    Well...
  20.  
  21. */
  22.  
  23. options results
  24.  
  25. parse arg maxsizex maxsizey cr cg cb border compression infile outfile
  26.  
  27. infile=strip(infile)
  28. outfile=strip(outfile)
  29.  
  30. address 'ArtEffect'
  31. LockGui
  32. LoadPic '"'infile'"'
  33.  
  34. /* Obtain info about the image */
  35. get stem size. pictureinfo
  36.  
  37. x = size.width
  38. y = size.height
  39.  
  40. /* ...and calculate the thumbnail resolution */
  41.  
  42. comp=trunc((maxsizex/x)*y)
  43.  
  44. if comp<=maxsizey then do
  45.  
  46.  
  47.     scalepic maxsizex-border comp-border
  48.     end
  49.  
  50. else do
  51.                                     /* No */
  52.  
  53.     comp2=trunc((maxsizey/y)*x)
  54.     scalepic comp2-border maxsizey-border
  55.  
  56. end
  57.  
  58. get stem size. pictureinfo
  59. setcolor r cr g cg b cb bg
  60. setcolor r cr g cg b cb
  61. scalecanvas newwidth (size.width+(border*2)) newheight (size.height+(border*2)) xoff border yoff border
  62.  
  63. /* And save the image */
  64.  
  65. SavePic '"'outfile'"' plugin 'JFIF-JPEG' quality '"'||compression||'"'
  66. ClosePic
  67. UnLockGui
  68.  
  69.